<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>消息列表条目管理</title>
	<meta name="decorator" content="default"/>
</head>
<body>
<div class="main-content">
    <tags:breadcrumb menuId="添加图文消息" />
    <div class="page-content">
        <form:form id="inputForm" modelAttribute="weiXinNewListItem" action="${ctx}/wechat/weiXinNewListItem/save" method="post" class="form-horizontal">
            <form:hidden path="id"/>
            <div class="form-group">
                <label class="col-sm-2 no-padding-right control-label">所属类型:</label>
                <div class="col-sm-10">
                    <form:select path="typeId" class="required col-sm-10">
                        <form:option value="" label="---请选择类型---"/>
                        <form:options items="${newListTypeList}" itemLabel="typeName" itemValue="id"/>
                    </form:select>
                    <span class="important">*</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-2 no-padding-right control-label">文章标题:</label>
                <div class="col-sm-10">
                    <form:input path="title" htmlEscape="false" maxlength="200" class="required col-sm-10"/>
                    <span class="important">*</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-2 no-padding-right control-label">文章描述:</label>
                <div class="col-sm-10">
                    <form:textarea path="description" htmlEscape="false" rows="2" maxlength="200" class="col-sm-10"/>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-2 no-padding-right control-label">缩略图链接:</label>
                <div class="col-sm-10">
                    <form:input path="picUrl" htmlEscape="false" maxlength="200" class="required col-sm-6"/>
                    <span class="important">*</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-2 no-padding-right control-label">原文链接:</label>
                <div class="col-sm-10">
                    <form:input path="url" htmlEscape="false" maxlength="200" class="required col-sm-10"/>
                    <span class="important">*</span>
                </div>
            </div><hr>
            <div class="form-group">
                <label class="col-sm-2 no-padding-right control-label">排序:</label>
                <div class="col-sm-4">
                    <form:input path="sort" htmlEscape="false" maxlength="200" class="required col-sm-6" placeholder="数值越小,排序越前"/>
                    <span class="important">*</span>
                </div>
                <label class="col-sm-2 no-padding-right control-label">是否显示:</label>
                <div class="col-sm-4">
                    <form:radiobuttons path="isShow" items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value"/>
                </div>
            </div>
            <div class="form-actions">
                <div class="col-md-offset-4">
                    <shiro:hasPermission name="wechat:weiXinNewListItem:edit"><input id="btnSubmit" class="btn btn-primary" type="button" value="保 存"/>&nbsp;</shiro:hasPermission>
                    <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
                </div>
            </div>
        </form:form>
    </div>
</div>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#name").focus();
            $("#btnSubmit").click(function(){
                if($("#inputForm").valid()){
                    var url = "${ctx}/wechat/weiXinNewListItem/save";
                    $.post(url,$("#inputForm").serialize(),function(data){
                        if(data.success){
                            showNote("success",function(){
                                window.location.href = "${ctx}/wechat/weiXinNewListItem/list";
                            },data.msg,"center");
                        }else{
                            showNote("error",function(){return false;},data.msg,"center");
                        }
                    });
                }else{
                    showNote("error",function(){return false;},"输入有误，请正确输入数据","center");
                }
            });
        });
    </script>
</body>
</html>
